<template>
    <div class="header-box">
        <header class="header-main">
            <div class="logout-btn" @click="router.push('/login')">
            <i class="fa fa-angle-left"></i>
            <span>登出</span>
            </div>

            <span>{{title}}</span>

            <div class="menu-btn" v-if="showMenu">
            <i class="fa fa-bars" @click="toFeedbackList"></i>
            </div>
        </header>

        <img src="../assets/header.png" />
    </div>
</template>

<script setup>
import { useRouter } from 'vue-router';

const props = defineProps({
    title: {
        type: String,
        default: '反馈任务列表',
    },
    showMenu: {
        type: Boolean,
        default: false,
    },
});

const router = useRouter();

const toFeedbackList = () => {
  router.push('/feedbackList');
};
</script>

<style scoped>
.header-main {
  position: relative;
  width: 100%;
  height: 12vw;
  background-color: #fff;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: center;
}

.logout-btn {
  position: absolute;
  left: 4vw;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
  color: white;
  padding: 1.5vw 3vw;
  border-radius: 5vw;
  font-size: 3.5vw;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
  cursor: pointer;
}

.logout-btn i {
  margin-right: 2vw;
  font-size: 4vw;
}

.logout-btn span {
  letter-spacing: 0.5vw;
}

.menu-btn {
  position: absolute;
  right: 4vw;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-btn i {
    font-size: 7vw;
}
</style>